<template>
  <div class="LogTestMonitor">
    <el-form ref="submitForm" class="demo-form-inline" :inline="true" :model="formInline" style="display: flex; flex-wrap: wrap">
      <el-form-item :label="translateTitle('Dams.ApplicationInterface.消息流水号')">
        <el-input
          v-model="formInline.messageGroupSysId"
          clearable
          :placeholder="translateTitle('Dams.ApplicationInterface.请输入')"
          size="mini"
          @change="messageGroupChange"
        />
      </el-form-item>
      <el-form-item :label="translateTitle('Dams.ApplicationInterface.组织机构ID')">
        <el-input
          v-model="formInline.messageGroupId"
          clearable
          :placeholder="translateTitle('Dams.ApplicationInterface.请输入')"
          size="mini"
          @change="messageGroupChange"
        />
      </el-form-item>
      <el-form-item :label="translateTitle('Dams.ApplicationInterface.接口ID')">
        <el-input
          v-model="formInline.messageId"
          clearable
          :placeholder="translateTitle('Dams.ApplicationInterface.请输入')"
          size="mini"
          @change="messageChange"
        />
      </el-form-item>
      <el-form-item :label="translateTitle('Dams.ApplicationInterface.来源IP')">
        <el-input
          v-model="formInline.fmJndi"
          clearable
          :placeholder="translateTitle('Dams.ApplicationInterface.请输入')"
          size="mini"
          @change="messageChange"
        />
      </el-form-item>
      <el-form-item label="查询时间">
        <el-date-picker
          v-model="value1"
          type="datetimerange"
          size="mini"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="defaultTime"
          :disabled-date="disabledDate"
          value-format="YYYY-MM-DD HH:mm:ss"
        ></el-date-picker>
      </el-form-item>
      <el-form-item :label="translateTitle('Dams.ApplicationInterface.消息健康状态')">
        <!-- <el-switch v-model="formInline.status" /> -->
        <el-select v-model="formInline.status" clearable :placeholder="translateTitle('Dams.ApplicationInterface.请选择')" size="mini">
          <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <template v-if="queryWhereList.length > 0">
        <el-form-item v-for="(item, index) in queryWhereList" :key="index" :label="item.STD_FIELD">
          <el-input v-model="item.value" clearable :placeholder="translateTitle('Dams.ApplicationInterface.请输入')" size="mini" />
        </el-form-item>
      </template>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">{{ translateTitle('Dams.ApplicationInterface.查询') }}</el-button>
      </el-form-item>
    </el-form>
    <div style="display: flex">
      <div :style="{ width: drawer ? '50%' : '100%' }">
        <Table
          :btn-fix="true"
          :column-list="tableColumn"
          :get-height="getHeight"
          :loading="tableLoading"
          :name="table.name"
          :style="{ height: `${getHeight}px` }"
          :tables="table"
        />
      </div>
      <div v-show="drawer" class="tab-content" style="width: 50%">
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.请求报文')" name="first">
            <p style="background-color: #1e1e1e; color: #fff; overflow-x: auto" :style="{ height: `${getHeight - 100}px` }">
              {{ requestData }}
            </p>
            <div style="margin-top: 10px">
              <el-button type="primary" @click="jsonFormatting">{{ translateTitle('Dams.ApplicationInterface.JSON格式化') }}</el-button>
              <el-button type="primary" @click="xmlFormatting">{{ translateTitle('Dams.ApplicationInterface.XML格式化') }}</el-button>
            </div>
          </el-tab-pane>
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.响应报文')" name="second">
            <p style="background-color: #1e1e1e; color: #fff; overflow-x: auto" :style="{ height: `${getHeight - 100}px` }">
              {{ responseData }}
            </p>
            <div style="margin-top: 10px">
              <el-button type="primary" @click="jsonFormatting">{{ translateTitle('Dams.ApplicationInterface.JSON格式化') }}</el-button>
              <el-button type="primary" @click="xmlFormatting">{{ translateTitle('Dams.ApplicationInterface.XML格式化') }}</el-button>
            </div>
          </el-tab-pane>
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.STD日志')" name="third">
            <Table
              :column-list="tableSTDColumn"
              :get-height="`${getHeight - 100} `"
              :name="viceTable.name"
              :style="{ height: `${getHeight - 100}px` }"
              :tables="viceTable"
            />
          </el-tab-pane>
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.消息流')" name="fourth">
            <Table
              :column-list="tableInfoColumn"
              :get-height="`${getHeight - 100} `"
              :name="infoTable.name"
              :style="{ height: `${getHeight - 100}px` }"
              :tables="infoTable"
            />
          </el-tab-pane>
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.SQL日志')" name="fifth">
            <Table
              :column-list="tableSqlColumn"
              :get-height="`${getHeight - 100} `"
              :name="sqlTable.name"
              :style="{ height: `${getHeight - 100}px` }"
              :tables="sqlTable"
            />
          </el-tab-pane>
          <el-tab-pane :label="translateTitle('Dams.ApplicationInterface.发送报文')" name="sixth">
            <Table
              :column-list="tableSendColumn"
              :get-height="`${getHeight - 100} `"
              :name="sendTable.name"
              :style="{ height: `${getHeight - 100}px` }"
              :tables="sendTable"
            />
          </el-tab-pane>
        </el-tabs>
        <vui-icon class="back" icon="arrow-right-circle-fill" @click="backTab" />
      </div>
    </div>
    <el-dialog v-model="sqlDialog" :title="translateTitle('Dams.ApplicationInterface.sql列表')" width="80%">
      <CodeEditor v-if="sqlDialog" v-model="sqlData" />
    </el-dialog>
    <el-dialog v-model="formattingDialog" :title="formattingTitle" width="80%">
      <CodeEditor v-if="formattingDialog" v-model="formattingData" :height="true" />
    </el-dialog>
    <el-dialog v-model="sendDialog" :title="translateTitle('Dams.ApplicationInterface.发送报文')" width="80%">
      <el-form v-if="sendDialog" ref="form" label-position="top" :model="sendDialogForm">
        <el-form-item :label="translateTitle('Dams.ApplicationInterface.请求报文')">
          <CodeEditor ref="VuiCodeEditor_SQL" v-model="sendDialogForm.APIM_REQUEST_MSG" name="APIM_REQUEST_MSG" />
        </el-form-item>
        <el-form-item :label="translateTitle('Dams.ApplicationInterface.响应报文')">
          <CodeEditor ref="VuiCodeEditor_PARAMS_S" v-model="sendDialogForm.APIM_RESPONSE_MSG" name="APIM_RESPONSE_MSG" />
        </el-form-item>
        <el-form-item :label="translateTitle('Dams.ApplicationInterface.异常报文')">
          <CodeEditor ref="VuiCodeEditor_RESULTS_S" v-model="sendDialogForm.APIM_EXCEPTION_MSG" name="APIM_EXCEPTION_MSG" />
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
  import { translateTitle } from '@/utils/i18n'
  import Table from '../../../components/table.vue'
  import debounce from 'lodash/debounce'
  import cloneDeep from 'lodash/cloneDeep'
  import { GFCD } from '@/utils/utils'
  import CodeEditor from '../../../components/codeEditor.vue'
  import { apimRequest, getList } from '../../../api/home'
  export default {
    name: 'TestLogTestMonitor',
    components: { Table, CodeEditor },
    data() {
      return {
        value1: '',
        defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)],
        tableLoading: false,
        sendDialogForm: {},
        sendDialog: false,
        sqlDialog: false,
        sqlData: '',
        queryWhereList: [],
        statusOptions: [
          { label: translateTitle('Dams.ApplicationInterface.成功'), value: true },
          { label: translateTitle('Dams.ApplicationInterface.失败'), value: false },
        ],
        formattingDialog: false,
        formattingTitle: '',
        formattingData: '',
        tableInfoColumn: [
          { label: translateTitle('Dams.ApplicationInterface.消息步骤'), porp: 'STEP' },
          { label: translateTitle('Dams.ApplicationInterface.时间'), sortable: true, porp: 'MESSAGE_TIME' },
          { label: translateTitle('Dams.ApplicationInterface.消息状态码'), porp: 'RETURNCODE' },
          { label: translateTitle('Dams.ApplicationInterface.描述'), porp: 'RETURNDESC' },
          { label: translateTitle('Dams.ApplicationInterface.步骤耗时'), porp: 'TIMECONSUMING' },
        ],
        tableSTDColumn: [
          { label: translateTitle('Dams.ApplicationInterface.消息ID'), porp: 'MESSAGEID' },
          { label: translateTitle('Dams.ApplicationInterface.消息层级'), porp: 'MESSAGETYPE' },
          { label: translateTitle('Dams.ApplicationInterface.消息行号'), porp: 'SN' },
          { label: translateTitle('Dams.ApplicationInterface.成功失败标记'), porp: 'RETURNCODE' },
          { label: translateTitle('Dams.ApplicationInterface.描述'), porp: 'RETURNDESC' },
        ],
        tableSqlColumn: [
          { porp: 'SQL_INDEX', label: translateTitle('Dams.ApplicationInterface.SQL执行序号') },
          { porp: 'EXEC_TIME', label: translateTitle('Dams.ApplicationInterface.SQL耗时') },
          { porp: 'SQL_TYPE', label: translateTitle('Dams.ApplicationInterface.SQL类型') },
          { porp: 'SQL_CONTENT', label: translateTitle('Dams.ApplicationInterface.SQL列表') },
          { porp: 'CREATE_TIME', label: translateTitle('Dams.ApplicationInterface.SQL执行时间') },
          { porp: 'ROWS', label: translateTitle('Dams.ApplicationInterface.受影响行') },
        ],
        tableSendColumn: [
          { porp: 'APIM_REQUEST_MSG', label: translateTitle('Dams.ApplicationInterface.请求报文') },
          { porp: 'APIM_RESPONSE_MSG', label: translateTitle('Dams.ApplicationInterface.响应报文') },
          { porp: 'APIM_EXCEPTION_MSG', label: translateTitle('Dams.ApplicationInterface.异常报文') },
        ],
        requestData: '',
        responseData: '',
        drawer: false,
        formInline: {
          messageGroupId: '',
          messageId: '',
          messageGroupSysId: '',
          adapterType: '',
          startTime: '',
          endTime: '',
          status: '',
          queryWhere: null,
          fmJndi: '',
        },
        tableColumn: [
          { label: translateTitle('Dams.ApplicationInterface.接口组ID'), porp: 'MESSAGEGROUPID' },
          { label: translateTitle('Dams.ApplicationInterface.接口ID'), porp: 'MESSAGEID' },
          { label: translateTitle('Dams.ApplicationInterface.接口描述'), porp: 'INTERFACE_DESC' },
          { label: translateTitle('Dams.ApplicationInterface.消息执行时间'), porp: 'MESSAGE_TIME' },
          { label: translateTitle('Dams.ApplicationInterface.消息状态码'), porp: 'STATUS' },
          { label: translateTitle('Dams.ApplicationInterface.来源IP'), porp: 'FM_JNDI' },
          { label: translateTitle('Dams.ApplicationInterface.来源JNDI'), porp: 'DATA_JNDI_NAME' },
          { label: translateTitle('Dams.ApplicationInterface.目标JNDI'), porp: 'OUT_JNDI_NAME' },
          { label: translateTitle('Dams.ApplicationInterface.消息流水号'), porp: 'MESSAGEGROUPSYSID' },
          { label: 'ADAPTERTYPE', porp: 'ADAPTER_TYPE_DESC' },
        ],
        sqlTable: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'sqlTestMonitor',
          operation: true,
        },
        sendTable: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'sendTestMonitor',
          operation: true,
        },
        infoTable: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'infoTestMonitor',
          operation: true,
        },
        viceTable: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'ViceTestMonitor',
          operation: true,
        },
        table: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'LogTestMonitor',
          operation: true,
        },
        clientHeight: 0,
        unsubs: [],
        configSetting: {},
        activeName: 'first',
        currentTable: {},
      }
    },
    computed: {
      getHeight() {
        return `${this.clientHeight - 200}`
      },
    },
    created() {
      this.configSetting = GFCD('apim')
      this.init()
    },
    methods: {
      disabledDate(time) {
        const nowDate = Date.now()
        const dateObjUnix = time.getTime()
        return nowDate < dateObjUnix
      },
      translateTitle,
      validateJSON(data) {
        if (typeof data == 'string') {
          try {
            let obj = JSON.parse(data)
            if (typeof obj == 'object' && obj) {
              return true
            } else {
              return false
            }
          } catch (e) {
            return false
          }
        }
      },
      validateXML(xmlContent) {
        let xmlDoc
        if (document.implementation.createDocument) {
          let parser = new DOMParser()
          xmlDoc = parser.parseFromString(xmlContent, 'text/xml')
          let error = xmlDoc.getElementsByTagName('parsererror')
          if (error.length > 0) {
            return false
          } else {
            return true
          }
        }
      },
      backTab() {
        this.drawer = false
      },
      //XML格式化
      showXml(text) {
        //去掉多余的空格
        text =
          '\n' +
          text
            .replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
              return name + ' ' + props.replace(/\s+(\w+=)/g, ' $1')
            })
            .replace(/>\s*?</g, '>\n<')

        //把注释编码
        text = text
          .replace(/\n/g, '\r')
          .replace(/<!--(.+?)-->/g, function ($0, text) {
            let ret = '<!--' + escape(text) + '-->'
            return ret
          })
          .replace(/\r/g, '\n')
        //调整格式
        let rgx = /\n(<(([^\\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/gm
        let nodeStack = []
        let output = text.replace(rgx, ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) => {
          let isClosed = isCloseFull1 == '/' || isCloseFull2 == '/' || isFull1 == '/' || isFull2 == '/'
          let prefix = ''
          if (isBegin == '!') {
            prefix = this.getPrefix(nodeStack.length)
          } else {
            if (isBegin != '/') {
              prefix = this.getPrefix(nodeStack.length)
              if (!isClosed) {
                nodeStack.push(name)
              }
            } else {
              nodeStack.pop()
              prefix = this.getPrefix(nodeStack.length)
            }
          }
          let ret = '\n' + prefix + all
          return ret
        })
        let outputText = output.substring(1)
        //把注释还原并解码，调格式
        outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)<!--(.+?)-->/g, ($0, prefix, text) => {
          if (prefix.charAt(0) == '\r') prefix = prefix.substring(1)
          text = unescape(text).replace(/\r/g, '\n')
          let ret = '\n' + prefix + '<!--' + text.replace(/^\s*/gm, prefix) + '-->'
          return ret
        })
        outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
        return outputText
      },
      getPrefix(prefixIndex) {
        let span = '    '
        let output = []
        for (let i = 0; i < prefixIndex; ++i) {
          output.push(span)
        }

        return output.join('')
      },
      sendFormatting(val) {
        let str
        if (this.validateJSON(val)) {
          str = JSON.stringify(JSON.parse(val), null, 4)
        } else {
          str = this.showXml(val)
        }
        return str
      },
      formatting(fn, title, hint) {
        switch (this.activeName) {
          case 'first':
            this.formattingData = this.requestData ? this.requestData : translateTitle('Dams.ApplicationInterface.暂无数据')
            break
          case 'second':
            this.formattingData = this.responseData ? this.responseData : translateTitle('Dams.ApplicationInterface.暂无数据')
            break
          default:
            break
        }
        if (!fn(this.formattingData)) return this.$baseMessage(hint, 'error')
        if (title == translateTitle('Dams.ApplicationInterface.JSON格式化数据'))
          this.formattingData = JSON.stringify(JSON.parse(this.formattingData), null, 4)
        if (title == translateTitle('Dams.ApplicationInterface.XML格式化数据')) this.formattingData = this.showXml(this.formattingData)
        this.formattingDialog = true
        this.formattingTitle = title
      },
      jsonFormatting() {
        this.formatting(
          this.validateJSON,
          translateTitle('Dams.ApplicationInterface.JSON格式化数据'),
          translateTitle('Dams.ApplicationInterface.JSON格式错误')
        )
      },
      xmlFormatting() {
        this.formatting(
          this.validateXML,
          translateTitle('Dams.ApplicationInterface.XML格式化数据'),
          translateTitle('Dams.ApplicationInterface.XML格式错误')
        )
      },
      handleClick() {},
      async getQuerykKey() {
        let damsurl = GFCD('dams')
        let url = `${damsurl.domain}${damsurl.baseUrl}`
        let res = await getList(url, {
          data: JSON.stringify({
            MESSAGE_GROUP_ID: this.formInline.messageGroupId,
            MESSAGE_ID: this.formInline.messageId,
            '#LIMIT#': '1',
            '#PAGE_SIZE#': 9999,
          }),
          method: 'APIMLogQuery',
        })
        console.log(res)
        this.queryWhereList = res.data['APIMLogQuery'].data
      },
      messageGroupChange(val) {
        if (val && this.formInline.messageId) {
          this.getQuerykKey()
        } else {
          this.queryWhereList = []
          return
        }
      },
      messageChange(val) {
        if (val && this.formInline.messageGroupId) {
          this.getQuerykKey()
        } else {
          this.queryWhereList = []
          return
        }
      },
      init() {
        this.eventInit()
        this.windowResize()
      },
      windowResize: debounce(function () {
        console.log('document.documentElement.clientHeight', document.documentElement.clientHeight)
        this.clientHeight = document.documentElement.clientHeight
      }, 100),
      async onSubmit(type) {
        console.log(this.configSetting.domain, type, this.value1)
        let url = `${this.configSetting.domain}/apim/log/query`
        if (this.value1 && this.value1.length > 1) {
          this.formInline.startTime = this.value1[0]
          this.formInline.endTime = this.value1[1]
        } else {
          this.formInline.startTime = ''
          this.formInline.endTime = ''
        }
        let p = cloneDeep(this.formInline)
        if (this.queryWhereList.length > 0) {
          p.queryWhere = {}
          this.queryWhereList.forEach((row) => {
            p.queryWhere[row.STD_FIELD] = row.value
          })
        }
        if (type != true) this.table.limit = 1
        p.pageSize = this.table.pageSize
        p.limit = this.table.limit
        console.log(p)
        this.tableLoading = true
        let res = await apimRequest(url, JSON.stringify(p), { 'Content-Type': 'application/json' })
        this.table.tableList = res.data
        this.table.count = res.count
        this.tableLoading = false
      },
      async getSql(REQUEST_UUID, pagesize, limit) {
        let sub = cloneDeep(this.formInline)
        if (this.queryWhereList.length > 0) {
          sub.queryWhere = {}
          this.queryWhereList.forEach((row) => {
            sub.queryWhere[row.STD_FIELD] = row.value
          })
        }
        console.log(sub)
        let res = await getList(`${this.configSetting.domain}/dams/dams-web`, {
          data: JSON.stringify({
            ...sub,
            REQUEST_UUID: REQUEST_UUID,
            '#LIMIT#': limit,
            '#PAGE_SIZE#': pagesize,
          }),
          // method: method,
          method: 'system.log.server.sql.query',
        })
        console.log(res)
        if (!res) return
        this.sqlTable.tableList = res.data.data.data
        this.sqlTable.count = res.data.data.count
      },
      async getRequest(p) {
        // let url = `${this.configSetting.domain}/apim/log/query/process`
        // let res = await apimRequest(url, JSON.stringify(p), { 'Content-Type': 'application/json' })
        console.log(p)
        // if (!res) return
        this.responseData = p.RESPONSE_MESSAGE
        this.requestData = p.REQUEST_MESSAGE
        this.sendTable.tableList = JSON.parse(p.SEND_MSG)
        this.sendTable.count = this.sendTable.tableList ? this.sendTable.tableList.length : 0
      },
      async getInfo(p) {
        let sub = cloneDeep(this.formInline)
        if (this.queryWhereList.length > 0) {
          sub.queryWhere = {}
          this.queryWhereList.forEach((row) => {
            sub.queryWhere[row.STD_FIELD] = row.value
          })
        }
        let url = `${this.configSetting.domain}/apim/log/query/step`
        let res = await apimRequest(url, JSON.stringify({ ...sub, ...p }), { 'Content-Type': 'application/json' })
        if (!res) return
        this.infoTable.tableList = res.data
        this.infoTable.count = res.count
      },
      async getStd(p) {
        let sub = cloneDeep(this.formInline)
        if (this.queryWhereList.length > 0) {
          sub.queryWhere = {}
          this.queryWhereList.forEach((row) => {
            sub.queryWhere[row.STD_FIELD] = row.value
          })
        }
        let url = `${this.configSetting.domain}/apim/log/query/stdLog`
        let res = await apimRequest(url, JSON.stringify({ ...sub, ...p }), { 'Content-Type': 'application/json' })
        if (!res) return
        this.viceTable.tableList = res.data
        this.viceTable.count = res.count
      },
      eventInit() {
        //主table翻页事件
        this.$sub(`LogTestMonitor_Table_on_LogTestMonitor`, (page_arr) => {
          console.log(page_arr)
          this.table.limit = page_arr[0].limit
          this.table.pageSize = page_arr[0].pageSize
          this.onSubmit(true)
        })
        //STD翻页事件
        this.$sub(`ViceTestMonitor_Table_on_ViceTestMonitor`, (page_arr) => {
          console.log(page_arr)
          let obj = {
            messageGroupId: this.currentTable.MESSAGEGROUPID,
            messageId: this.currentTable.MESSAGEID,
            messageGroupSysId: this.currentTable.MESSAGEGROUPSYSID,
            adapterType: this.currentTable.ADAPTERTYPE,
          }
          this.viceTable.limit = page_arr[0].limit
          this.viceTable.pageSize = page_arr[0].pageSize
          this.getStd({ ...obj, pageSize: page_arr[0].pageSize, limit: page_arr[0].limit })
        })
        this.$sub(`sqlTestMonitor_Table_on_sqlTestMonitor`, (page_arr) => {
          this.sqlTable.limit = page_arr[0].limit
          this.sqlTable.pageSize = page_arr[0].pageSize
          this.getSql(this.currentTable.MESSAGEGROUPSYSID, page_arr[0].pageSize, page_arr[0].limit)
        })
        //双击事件
        this.$sub(`LogTestMonitor_Table_clickOne_LogTestMonitor`, (page_arr) => {
          let obj = {
            messageGroupId: page_arr[0].MESSAGEGROUPID,
            messageId: page_arr[0].MESSAGEID,
            messageGroupSysId: page_arr[0].MESSAGEGROUPSYSID,
            adapterType: page_arr[0].ADAPTERTYPE,
          }
          this.currentTable = page_arr[0]
          this.getRequest(page_arr[0])
          this.getStd({ ...obj, pageSize: 50, limit: 1 })
          this.getInfo({ ...obj, pageSize: 50, limit: 1 })
          this.getSql(page_arr[0].MESSAGEGROUPSYSID, 50, 1)
          this.drawer = true
        })
        this.unsubs.push(`LogTestMonitor_Table_clickOne_LogTestMonitor`)
        // 打开sql弹框
        this.$sub(`sqlTestMonitor_Table_clickOne_sqlTestMonitor`, (page_arr) => {
          console.log(page_arr)
          this.sqlDialog = true
          this.sqlData = JSON.stringify(page_arr[0].SQL_CONTENT)
        })
        this.$sub('sendTestMonitor_Table_clickOne_sendTestMonitor', (page_arr) => {
          console.log(page_arr)
          this.sendDialog = true
          this.sendDialogForm = page_arr[0]
          if (!this.sendDialogForm.APIM_EXCEPTION_MSG) this.sendDialogForm.APIM_EXCEPTION_MSG = ''
          this.sendDialogForm.APIM_REQUEST_MSG = this.sendFormatting(this.sendDialogForm.APIM_REQUEST_MSG)
          this.sendDialogForm.APIM_RESPONSE_MSG = this.sendFormatting(this.sendDialogForm.APIM_RESPONSE_MSG)
          this.sendDialogForm.APIM_EXCEPTION_MSG = this.sendFormatting(this.sendDialogForm.APIM_EXCEPTION_MSG)
        })
        this.unsubs.push(`sqlTestMonitor_Table_clickOne_sqlTestMonitor`)
        this.$sub(`ViceTestMonitor_Table_clickOne_ViceTestMonitor`, (page_arr) => {
          console.log(page_arr)
          this.formattingDialog = true
          this.formattingTitle = translateTitle('Dams.ApplicationInterface.STD日志')
          this.formattingData = JSON.stringify(page_arr[0], null, 4)
        })
        this.unsubs.push(`ViceTestMonitor_Table_clickOne_ViceTestMonitor`)
        this.$sub(`LogTestMonitor_Table_resetBtn_retransmission`, async (page_arr) => {
          console.log(page_arr)
          let url = `${this.configSetting.domain}/apim/config/inRetry`
          let res = await apimRequest(
            url,
            JSON.stringify({
              messageGroupId: page_arr[0].MESSAGEGROUPID,
              messageId: page_arr[0].MESSAGEID,
              messageGroupSysId: page_arr[0].MESSAGEGROUPSYSID,
            }),
            { 'Content-Type': 'application/json' }
          )
          console.log(res)
          this.$baseMessage(res.msg, 'success')
        })
        this.unsubs.push(`LogTestMonitor_Table_resetBtn_retransmission`)
      },
    },
  }
</script>
<style lang="scss" scoped>
  .LogTestMonitor {
    padding: 15px;
    box-sizing: border-box;
    width: 100%;
    .tab-content {
      position: relative;
      .back {
        position: absolute;
        right: 0;
        top: -18px;
        z-index: 12;
        cursor: pointer;
      }
    }
    :deep() {
      .el-tabs__nav-prev,
      .el-tabs__nav-next {
        line-height: 20px;
      }
      .el-form-item--small.el-form-item {
        width: auto;
        margin-bottom: 10px;
      }
    }
  }
  :deep().vxe-table--render-default .vxe-body--column.col--ellipsis,
  .vxe-table--render-default.vxe-editable .vxe-body--column,
  .vxe-table--render-default .vxe-footer--column.col--ellipsis,
  .vxe-table--render-default .vxe-header--column.col--ellipsis {
    height: 25px;
  }
</style>
